package org.kfive.nova.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 16-5-31
 * Time: 下午10:36
 * To change this template use File | Settings | File Templates.
 */
public class FutureExample {

    private final FutureTask<String> future = new FutureTask<String>(new Callable<String>() {
        @Override
        public String call() throws Exception {
            return "";  //To change body of implemented methods use File | Settings | File Templates.
        }
    });

    private final Thread thread = new Thread(future);

    public void start(){
        this.thread.start();
    }

    /*public String get(){
        try {
            return this.future.get();
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (ExecutionException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }*/
}
